<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="../js/cookie.js"></script>
</head>

<body>
    <div id="tips">
        <a href="./login.html">登录</a>
        <a href="./register.html">注册</a>

        <!-- 
            欢迎,xxx   
         -->
    </div>
</body>
<!--  -->
<script>
    // 主页 标识用户身份
    // 存在 lgc      =>  欢迎,xxx   
    // 不存在        => 

    var tips = document.getElementById("tips");

    // 标识用户身份
    if (getCookie("lgc")) {
        var user = getCookie("lgc");
        tips.innerHTML = `欢迎您,${user} <button  class="exit" onclick="exit()">退出</button>`;
    }

    function exit() {
        delCookie("lgc");
        location.reload();
    }

</script>

</html>